package com.fitzone.web.controller.mini;

import com.fitzone.common.result.Result;
import com.fitzone.model.dto.CoachMiniDTO;
import com.fitzone.model.vo.CoachMiniVO;
import com.fitzone.model.vo.CoachVO;
import com.fitzone.web.service.CoachService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequiredArgsConstructor
@RestController
@RequestMapping("/mini/coach")
@Api(tags = "小程序-教练")
public class MiniCoachController {
    private final CoachService coachService;

    /**
     * 教练详情
     * @param coachId
     * @return
     */
    @ApiOperation("小程序-教练详情")
    @GetMapping("/info/{coachId}")
    public Result<CoachVO> coachDetail(@PathVariable Long coachId){
        return Result.ok(coachService.getCoachById(coachId));
    }

    /**
     * 教练列表
     * @param coachMiniDTO
     * @return
     */
    @ApiOperation("小程序-教练列表")
    @GetMapping("/list")
    public Result<List<CoachMiniVO>> coachList(CoachMiniDTO coachMiniDTO){
        return Result.ok(coachService.miniCoachList(coachMiniDTO));
    }
}
